package com.lyy.photovoltaic.controller;

import com.lyy.photovoltaic.common.vo.ResultVO;
import com.lyy.photovoltaic.service.OrdersDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/ordersDetails")
@Api(value = "用户订单详情接口", tags = "订单详情管理")
public class OrderDetailsController {
    @Autowired
    OrdersDetailsService ordersDetailsService;

    @GetMapping(value = "/{ODId}")
    @ApiImplicitParam(dataType = "string", name = "ODId", value = "根据用户id查询相关历史订单的详情", required = true)
    public ResultVO findOrderDetailsById(@PathVariable("ODId") String ODId) {
        ResultVO resultVO = ordersDetailsService.findOrderDetailsById(ODId);
        return resultVO;
    }

    @PostMapping(value = "/find")
    public ResultVO findOrderDetailsLists(@RequestBody String[] oDIds) {
//        System.out.println(oDIds);
        ResultVO resultVO = ordersDetailsService.findOrderDetailsLists(oDIds);
        return resultVO;

    }
}

